import axios from '@/libs/api.request'

export class RoleApi {
  // 根据条件获取角色信息
  static getList (params) {
    return axios.request({
      url: '/Role/GetList',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 根据ID获取角色信息
  static getModel (params) {
    return axios.request({
      url: '/Role/GetModel',
      method: 'get',
      enctype: 'multipart/form-data',
      params: params
    })
  }

  // 保存角色信息
  static save (params) {
    return axios.request({
      url: '/Role/Save',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 根据角色ID批量保存或删除用户角色列表(绑定/取消绑定)
  static saveUserRole (params) {
    return axios.request({
      url: '/Role/SaveUserRole',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 启用/禁用角色信息
  static enabledList (params) {
    return axios.request({
      url: '/Role/EnabledList',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 删除角色信息
  static delete (params) {
    return axios.request({
      url: '/Role/Delete',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 获取权限树
  static getPermissionTreeList (params) {
    return axios.request({
      url: '/Role/GetPermissionTreeList',
      method: 'get',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 根据角色批量添加或删除角色权限
  static setRolePermission (params) {
    return axios.request({
      url: '/Role/SetRolePermission',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }
}
